#define MODULESSCENE_API __declspec(dllexport)

#include "ModulesSceneInterface.h"
#define VLD_FORCE_ENABLE
#include "vld.h"
#include "gl/GL.H"
#include "GLU.H"


CBigMassDiffuseModulesInterface::CBigMassDiffuseModulesInterface()
{
}

CBigMassDiffuseModulesInterface::~CBigMassDiffuseModulesInterface()
{
}

/***********************************************
The Big Mass Modules
***********************************************/
Point3f **CBigMassDiffuseModulesInterface::GetBigMassDiffuseModuleOne(float oa, float ob)
{
	Point3f **fPoint;
	unsigned int j;
	float n;

	//Initial the Point
	fPoint = new Point3f *[7];
	for (int i = 0; i < 7; i++)
	{
		fPoint[i] = new Point3f[51];
	}

	assert(fPoint);

	//the first step
	//f(x) = 0.2 * x
	for (j = 0, n = 0.f; j <= 10; j++, n += 0.05)
	{
		fPoint[0][j].x = n;
		fPoint[0][j].y = (float)(0.2 * n);
		fPoint[0][j].z = 0.f;
	}
	//f(x) = 0.1
	for (j = 11, n = 0.55; j <= 20; j++, n += 0.05)
	{
		fPoint[0][j].x = n;
		fPoint[0][j].y = (float)(0.1 * n + 0.05);
		fPoint[0][j].z = 0.f;
	}
	//f(x) = 0.2 * x
	for (j = 21, n = 1.05; j <= 30; j++, n += 0.05)
	{
		fPoint[0][j].x = n;
		fPoint[0][j].y = (float)(0.2 * n - 0.05);
		fPoint[0][j].z = 0.f; 
	}
	//r = 0.3
	for (j = 31, n = 1.5125; j <= 50;j++, n += 0.0125)
	{
		fPoint[0][j].x = n;
		fPoint[0][j].y = sqrt((float)(0.25*0.25)-(float)((n-1.5)*(n-1.5)));
		fPoint[0][j].z = 0.f;
		fPoint[0][50].y = 0.f;
	}

	//the second step
	//f(x) = 0.4 * x
	for (j = 0, n = 0.f; j <= 10; j++, n += 0.05)
	{
		fPoint[1][j].x = n;
		fPoint[1][j].y = (float)(n * 0.4);
		fPoint[1][j].z = 0.f;
	}
	//f(x) = 0.2
	for (j = 11, n = 0.55; j <=20; j++, n += 0.05)
	{
		fPoint[1][j].x = n;
		fPoint[1][j].y = (float)(0.2 * n + 0.1);
		fPoint[1][j].z = 0.f;
	}
	//f(x) = 0.4 * x;
	for (j = 21, n = 1.05; j <= 30; j++, n += 0.05)
	{
		fPoint[1][j].x = n;
		fPoint[1][j].y = (float)(0.4 * n - 0.1);
		fPoint[1][j].z = 0.f;
	}
	//r = 0.6
	for (j = 31, n =1.525; j <= 50; j++, n += 0.025)
	{
		fPoint[1][j].x = n;
		fPoint[1][j].y = sqrt((float)(0.5*0.5) - (float)((n-1.5)*(n-1.5)));
		fPoint[1][j].z = 0.f;
	}

	//the third step
	//f(x) = 0.6 * x
	for (j = 0, n = 0.f; j <= 10; j++, n += 0.05)
	{
		fPoint[2][j].x = n;
		fPoint[2][j].y = (float)(0.6 * n);
		fPoint[2][j].z = 0.f;
	}
	//f(x) = 0.3
	for (j = 11, n = 0.55; j <= 20; j++, n += 0.05)
	{
		fPoint[2][j].x = n;
		fPoint[2][j].y = (0.3 * n + 0.15);
		fPoint[2][j].z = 0.f;
	}
	//f(x) = 0.6 * x
	for (j = 21, n = 1.05; j <= 30; j++, n += 0.05)
	{
		fPoint[2][j].x = n;
		fPoint[2][j].y = (float)(0.6 * n - 0.15);
		fPoint[2][j].z = 0.f;
	}
	//r = 0.9
	for (j = 31, n = 1.5375; j <= 50; j++, n += 0.0375)
	{
		fPoint[2][j].x = n;
		fPoint[2][j].y = sqrt((float)(0.75 * 0.75) - (float)((n-1.5)*(n-1.5)));
		fPoint[2][j].z = 0.f;
		fPoint[2][50].y = 0.f;
	}


	//get the Axis Points
	for (j = 0, n = 0.f; j <= 30; j++, n += 0.05)
	{
		fPoint[3][j].x = n;
		fPoint[3][j].y = 0.f;
		fPoint[3][j].z = 0.f;
	}
	for (j = 31, n = 1.5125; j <= 50; j++, n += 0.0125)
	{
		fPoint[3][j].x = n;
		fPoint[3][j].y = 0.f;
		fPoint[3][j].z = 0.f;
	}

	//get the symmetrical points
	for (int i = 0; i < 3; i++)
	{
		for (j = 0; j <= 50; j++)
		{
			fPoint[i+4][j].x = fPoint[i][j].x;
			fPoint[i+4][j].y = -fPoint[i][j].y;
			fPoint[i+4][j].z = 0.f;
		}
	}

	return fPoint;
}


Point3f **CBigMassDiffuseModulesInterface::GetBigMassDiffuseModuleTwo(float ta, float tb)
{
	Point3f **fPoint;
	unsigned int i, j;
	float n;

	fPoint = new Point3f *[7];
	for (i = 0; i < 7; i++)
	{
		fPoint[i] = new Point3f[91];
	}

	assert(fPoint);

	//get the first step
	for (j = 0, n = 0.f; j <= 20; j++, n += 0.05)
	{
		fPoint[0][j].x = n;
		fPoint[0][j].y = (float)(0.3 * n);
		fPoint[0][j].z = 0.f;
	}
	for (j = 21, n = 1.05; j <= 40; j++, n += 0.05)
	{
		fPoint[0][j].x = n;
		fPoint[0][j].y = (float)(-0.1 * n + 0.4);
		fPoint[0][j].z = 0.f;
	}
	for (j = 41, n = 2.05; j <= 45; j++, n += 0.05)
	{
		fPoint[0][j].x = n;
		fPoint[0][j].y = (float)(n * 0.1);
		fPoint[0][j].z = 0.f;
	}
	for(j = 46, n = 2.3; j <= 65; j++, n += 0.05)
	{
		fPoint[0][j].x = n;
		fPoint[0][j].y = (float)(0.3*n - 0.45);
		fPoint[0][j].z = 0.f;
	}
	for (j = 66, n = 3.271; j <= 90; j++, n += 0.021)
	{
		fPoint[0][j].x = n;
		fPoint[0][j].y = (float)sqrt((float)(0.525*0.525) - (float)((n-3.25)*(n-3.25)));
		fPoint[0][j].z = 0.f;
		fPoint[0][90].y = 0.f;
	}

	//the second step
	for (j = 0, n = 0.f; j <= 20; j++, n += 0.05)
	{
		fPoint[1][j].x = n;
		fPoint[1][j].y = (float)(0.5 * n);
		fPoint[1][j].z = 0.f;
	}
	for (j = 21, n = 1.05; j <= 40; j++, n += 0.05)
	{
		fPoint[1][j].x = n;
		fPoint[1][j].y = (float)(-0.1*n + 0.6);
		fPoint[1][j].z = 0.f;
	}
	for (j = 41, n = 2.05; j <= 45; j++, n += 0.05)
	{
		fPoint[1][j].x = n;
		fPoint[1][j].y = (float)(n * 0.2);
		fPoint[1][j].z = 0.f;
	}
	for (j = 46, n = 2.3; j <= 65; j++, n += 0.05)
	{
		fPoint[1][j].x = n;
		fPoint[1][j].y = (float)(0.4 * n - 0.45);
		fPoint[1][j].z = 0.f;
	}
	for (j = 66, n = 3.288; j <= 90; j++, n += 0.038)
	{
		fPoint[1][j].x = n;
		fPoint[1][j].y = sqrt((float)(0.95*0.95)-(float)((n-3.25)*(n-3.25)));
		fPoint[1][j].z = 0.f;
		fPoint[1][90].y = 0.f;
	}


	//The third step
	for (j = 0, n = 0.f; j <= 20; j++, n += 0.05)
	{
		fPoint[2][j].x = n;
		fPoint[2][j].y = (float)(n * 0.7);
		fPoint[2][j].z = 0.f;
	}
	for (j = 21, n = 1.05; j <= 40; j++, n += 0.05)
	{
		fPoint[2][j].x = n;
		fPoint[2][j].y = (float)(-0.1*n + 0.8);
		fPoint[2][j].z = 0.f;
	}
	for(j = 41, n = 2.05; j <= 45; j++, n += 0.05)
	{
		fPoint[2][j].x = n;
		fPoint[2][j].y = (float)(n * 0.3);
		fPoint[2][j].z = 0.f;
	}
	for (j = 46, n = 2.3; j <= 65; j++, n += 0.05)
	{
		fPoint[2][j].x = n;
		fPoint[2][j].y = (float)(0.5*n - 0.45);
		fPoint[2][j].z = 0.f;
	}
	for (j = 66, n = 3.297; j <= 90; j++, n += 0.047)
	{
		fPoint[2][j].x = n;
		fPoint[2][j].y = sqrt((float)(1.175*1.175) - (float)((n-3.25)*(n-3.25)));
		fPoint[2][j].z = 0.f;
		fPoint[2][90].y = 0.f;
	}

	//Get the Axis Points
	for (j= 0, n = 0.f; j <= 65; j++, n += 0.05)
	{
		fPoint[3][j].x = n;
		fPoint[3][j].y = 0.f;
		fPoint[3][j].z = 0.f;
	}
	for (j = 66, n = 3.281; j <= 90; j++, n += 0.031)
	{
		fPoint[3][j].x = n;
		fPoint[3][j].y = 0.f;
		fPoint[3][j].z = 0.f;
	}

	//Get the symmetrical points
	for (i = 0; i < 3; i++)
	{
		for (j = 0; j <= 90; j++)
		{
			fPoint[i+4][j].x = fPoint[i][j].x;
			fPoint[i+4][j].y = -fPoint[i][j].y;
			fPoint[i+4][j].z = 0.f;
		}
	}

	return fPoint;
}

Point3f **CBigMassDiffuseModulesInterface::GetBigMassDiffuseModuleThree(float ra, float rb)
{
	Point3f **fPoint;
	unsigned i, j;
	float n;

	//Initial the Point
	fPoint = new Point3f *[7];
	for (i = 0; i < 7; i++)
	{
		fPoint[i] = new Point3f[181];
	}

	assert(fPoint);

	//the first step
	for (j = 0, n = 0.f; j <= 40; j++, n += 0.05)
	{
		fPoint[0][j].x = n;
		fPoint[0][j].y = (float)(0.4 * n);
		fPoint[0][j].z = 0.f;
	}
	for (j = 41, n = 2.05; j <= 50; j++, n += 0.05)
	{
		fPoint[0][j].x = n;
		fPoint[0][j].y = (float)(-0.1 * n + 1.0);
		fPoint[0][j].z = 0.f;
	}
	for (j = 51, n = 2.55; j <= 90; j++, n += 0.05)
	{
		fPoint[0][j].x = n;
		fPoint[0][j].y = (float)(0.3 * n);
		fPoint[0][j].z = 0.f;
	}
	for (j = 91, n = 4.55; j <= 110; j++, n += 0.05)
	{
		fPoint[0][j].x = n;
		fPoint[0][j].y = (float)(0.1 * n + 0.9);
		fPoint[0][j].z = 0.f;
	}
	for (j = 111, n = 5.55; j <= 130; j++, n += 0.05)
	{
		fPoint[0][j].x = n;
		fPoint[0][j].y = (float)(1.45);
		fPoint[0][j].z = 0.f;
	}
	for (j = 131, n = 6.529; j <= 180; j++, n += 0.029)
	{
		fPoint[0][j].x = n;
		fPoint[0][j].y = (float)sqrt((float)(1.45*1.45) - (float)((n-6.5)*(n-6.5)));
		fPoint[0][j].z = 0.f;
		fPoint[0][180].y = 0.f;
	}

	//the second step
	for (j = 0, n = 0.f; j <= 40; j++, n += 0.05)
	{
		fPoint[1][j].x = n;
		fPoint[1][j].y = (float)(n * 0.6);
		fPoint[1][j].z = 0.f;
	}
	for (j = 41, n = 2.05; j <= 50; j++, n += 0.05)
	{
		fPoint[1][j].x = n;
		fPoint[1][j].y = (float)(-0.1 * n + 1.405);
		fPoint[1][j].z = 0.f;
	}
	for ( j = 51, n = 2.55; j <= 90; j++, n += 0.05)
	{
		fPoint[1][j].x = n;
		fPoint[1][j].y = (float)(0.3 *n + 0.405);
		fPoint[1][j].z = 0.f;
	}
	for (j = 91, n = 4.55; j <= 110; j++, n += 0.05)
	{
		fPoint[1][j].x = n;
		fPoint[1][j].y = (float)(0.1 * n + 1.3);
		fPoint[1][j].z = 0.f;
	}
	for(j = 111, n = 5.55; j <= 130; j++, n += 0.05)
	{
		fPoint[1][j].x = n;
		fPoint[1][j].y = 1.85;
		fPoint[1][j].z = 0.f;
	}
	for (j = 131, n = 6.537; j <= 180; j++, n += 0.037)
	{
		fPoint[1][j].x = n;
		fPoint[1][j].y = (float)sqrt((float)(1.85*1.85) - (float)((n-6.5)*(n-6.5)));
		fPoint[1][j].z = 0.f;
		fPoint[1][180].y =0.f;
	}

	//the third step
	for (j = 0, n = 0.f; j <= 40; j++, n += 0.05)
	{
		fPoint[2][j].x = n;
		fPoint[2][j].y = (float)(0.8 * n);
		fPoint[2][j].z = 0.f;
	}
	for (j = 41, n = 2.05; j <= 50; j++, n += 0.05)
	{
		fPoint[2][j].x = n;
		fPoint[2][j].y = (float)(-0.1*n + 1.8);
		fPoint[2][j].z = 0.f;
	}
	for (j = 51, n = 2.55; j <= 90; j++, n += 0.05)
	{
		fPoint[2][j].x = n;
		fPoint[2][j].y = (float)(0.3 * n + 0.8);
		fPoint[2][j].z = 0.f;
	}
	for (j = 91, n = 4.55; j <= 110; j++, n += 0.05)
	{
		fPoint[2][j].x = n;
		fPoint[2][j].y = (float)(0.1 * n + 1.7);
		fPoint[2][j].z = 0.f;
	}
	for (j = 111, n = 5.55; j <= 130; j++, n += 0.05)
	{
		fPoint[2][j].x = n;
		fPoint[2][j].y = (float)(2.25);
		fPoint[2][j].z = 0.f;
	}
	for (j = 131 , n = 6.545; j <= 180; j++, n += 0.045)
	{
		fPoint[2][j].x = n;
		fPoint[2][j].y = (float)sqrt((float)(2.25*2.25) - (float)((n-6.5)*(n-6.5)));
		fPoint[2][j].z = 0.f;
		fPoint[2][180].y = 0.f;
	}

	//Get the Axis Points
	for (i = 0, n = 0.f; i <= 130; i++, n += 0.05)
	{
		fPoint[3][i].x = n;
		fPoint[3][i].y = 0.f;
		fPoint[3][i].z = 0.f;
	}
	for (i = 131, n = 6.529; i <= 180; i++, n += 0.029)
	{
		fPoint[3][i].x = n;
		fPoint[3][i].y = 0.f;
		fPoint[3][i].z = 0.f;
	}

	//Get the symmetrical
	for (i = 0; i < 3; i++)
	{
		for (j = 0; j <= 180; j++)
		{
			fPoint[i+4][j].x = fPoint[i][j].x;
			fPoint[i+4][j].y = -fPoint[i][j].y;
			fPoint[i+4][j].z = 0.f;
		}
	}

	return fPoint;
}

Point3f **CBigMassDiffuseModulesInterface::GetBigMassDiffuseModuleFour(float fa, float fb)
{
	Point3f **fPoint;
	unsigned int i, j;
	float n;

	//Initial the points
	fPoint = new Point3f *[7];
	for (i = 0; i < 7; i++)
	{
		fPoint[i] = new Point3f[281];
	}

	assert(fPoint);

	//the first step
	for (j = 0, n = 0.f; j <= 60; j++, n += 0.05)
	{
		fPoint[0][j].x = n;
		fPoint[0][j].y = (float)(0.6 * n);
		fPoint[0][j].z = 0.f;
	}
	for (j = 61, n = 3.05; j <= 100; j++, n += 0.05)
	{
		fPoint[0][j].x = n;
		fPoint[0][j].y = (float)(-0.1 * n + 2.1);
		fPoint[0][j].z = 0.f;
	}
	for (j = 101, n = 5.05; j <= 120; j++, n += 0.05)
	{
		fPoint[0][j].x = n;
		fPoint[0][j].y = (float)(0.2 * n + 0.6);
		fPoint[0][j].z = 0.f;
	}
	for (j = 121, n = 6.05; j <= 140; j++, n += 0.05 )
	{
		fPoint[0][j].x = n;
		fPoint[0][j].y = (float)(0.3 * n);
		fPoint[0][j].z = 0.f;
	}
	for (j = 141, n = 7.05; j <= 160; j++, n += 0.05)
	{
		fPoint[0][j].x = n;
		fPoint[0][j].y = (float)(0.4 * n - 0.7);
		fPoint[0][j].z = 0.f;
	}
	for (j = 161, n = 8.05; j <= 200; j++, n += 0.05)
	{
		fPoint[0][j].x = n;
		fPoint[0][j].y = (float)(0.6 * n - 2.3);
		fPoint[0][j].z = 0.f;
	}
	for (j = 201, n = 10.04625; j <= 280; j++, n += 0.04625)
	{
		fPoint[0][j].x = n;
		fPoint[0][j].y = (float)sqrt((float)(3.7*3.7) - (float)((n-10.f)*(n-10.f)));
		fPoint[0][j].z = 0.f;
		fPoint[0][280].y = 0.f;
	}

	//the second step
	for(j = 0, n = 0.f; j <= 60; j++, n += 0.05)
	{
		fPoint[1][j].x = n;
		fPoint[1][j].y = (float)(n * 0.8);
		fPoint[1][j].z = 0.f;
	}
	for (j = 61, n = 3.05; j <= 100; j++, n += 0.05)
	{
		fPoint[1][j].x = n;
		fPoint[1][j].y = (float)(-0.1 * n + 2.7);
		fPoint[1][j].z = 0.f;
	}
	for (j = 101, n = 5.05; j <= 120; j++, n += 0.05)
	{
		fPoint[1][j].x = n;
		fPoint[1][j].y = (float)(0.2 * n + 1.2);
		fPoint[1][j].z = 0.f;
	}
	for (j = 121, n = 6.05; j <= 140; j++, n += 0.05)
	{
		fPoint[1][j].x = n;
		fPoint[1][j].y = (float)(0.3 * n + 0.6);
		fPoint[1][j].z = 0.f;
	}
	for (j = 141, n = 7.05; j <= 160; j++, n += 0.05 )
	{
		fPoint[1][j].x = n;
		fPoint[1][j].y = (float)(0.4 * n -  0.1);
		fPoint[1][j].z = 0.f;
	}
	for (j = 161, n = 8.05; j <= 200; j++, n += 0.05)
	{
		fPoint[1][j].x = n;
		fPoint[1][j].y = (float)(0.6 * n - 1.7);
		fPoint[1][j].z = 0.f;
	}
	for(j = 201, n = 10.05375; j <= 280; j++, n += 0.05375)
	{
		fPoint[1][j].x = n;
		fPoint[1][j].y = (float)sqrt((float)(4.3*4.3) - (float)((n-10.f)*(n-10.f)));
		fPoint[1][j].z = 0.f;
		fPoint[1][280].y = 0.f;
	}

	//the third step
	for (j = 0, n = 0.f; j <= 60; j++, n += 0.05)
	{
		fPoint[2][j].x = n;
		fPoint[2][j].y = (float)(n * 1.0);
		fPoint[2][j].z = 0.f;
	}
	for (j = 61, n = 3.05; j <= 100; j++, n += 0.05)
	{
		fPoint[2][j].x = n;
		fPoint[2][j].y = (float)(-0.1 * n + 3.3);
		fPoint[2][j].z = 0.f;
	}
	for (j = 101, n = 5.05; j <= 120; j++, n += 0.05)
	{
		fPoint[2][j].x = n;
		fPoint[2][j].y = (float)(0.2 * n + 1.6);
		fPoint[2][j].z = 0.f;
	}
	for (j = 121, n = 6.05; j <= 140; j++, n += 0.05)
	{
		fPoint[2][j].x = n;
		fPoint[2][j].y = (float)(0.3 * n + 1.0);
		fPoint[2][j].z = 0.f;
	}
	for (j = 141, n = 7.05; j <= 160; j++, n += 0.05)
	{
		fPoint[2][j].x = n;
		fPoint[2][j].y = (float)(0.4 * n + 0.3);
		fPoint[2][j].z = 0.f;
	}
	for (j = 161, n = 8.05; j <= 200; j++, n += 0.05)
	{
		fPoint[2][j].x = n;
		fPoint[2][j].y = (float)(0.6 * n - 1.3);
		fPoint[2][j].z = 0.f;
	}
	for (j = 201, n = 10.05875; j <= 280; j++, n += 0.05875)
	{
		fPoint[2][j].x = n;
		fPoint[2][j].y = (float)sqrt((float)(4.7*4.7) - (float)((n-10.f)*(n-10.f)));
		fPoint[2][j].z = 0.f;
		fPoint[2][280].y = 0.f;
	}

	//Get the Axis Points
	for (j = 0, n = 0.f; j <= 200; j++, n += 0.05)
	{
		fPoint[3][j].x = n;
		fPoint[3][j].y = 0.f;
		fPoint[3][j].z = 0.f;
	}
	for (j = 201, n = 10.04625; j <= 280; j++, n += 0.04625)
	{
		fPoint[3][j].x = n;
		fPoint[3][j].y = 0.f;
		fPoint[3][j].z = 0.f;
	}

	//Get the symmetrical points
	for (i = 0; i < 3; i++)
	{
		for (j = 0; j <= 280; j++)
		{
			fPoint[i+4][j].x = fPoint[i][j].x;
			fPoint[i+4][j].y = -fPoint[i][j].y;
			fPoint[i+4][j].z = 0.f;
		}
	}

	return fPoint;
}

Point3f **CBigMassDiffuseModulesInterface::GetBigMassDiffuseModuleFive(float va, float vb)
{
	Point3f **fPoint;
	unsigned int i, j;
	float n;

	//Initial the point
	fPoint = new Point3f *[7];
	for (i = 0; i < 7; i++)
	{
		fPoint[i] = new Point3f[441];
	}

	assert(fPoint);

	//the first step
	for (j = 0, n = 0.f; j <= 60; j++, n += 0.05)
	{
		fPoint[0][j].x = n;
		fPoint[0][j].y = (float)(n * 0.5);
		fPoint[0][j].z = 0.f;
	}
	for (j = 61, n = 3.05; j <= 100; j++, n += 0.05)
	{
		fPoint[0][j].x = n;
		fPoint[0][j].y = (float)(-0.1 * n + 1.8);
		fPoint[0][j].z = 0.f;
	}
	for (j = 101, n = 5.05; j <= 120; j++, n += 0.05)
	{
		fPoint[0][j].x = n;
		fPoint[0][j].y = (float)(0.3 * n - 0.2);
		fPoint[0][j].z = 0.f;
	}
	for(j = 121, n = 6.05; j <= 130; j++, n += 0.05)
	{
		fPoint[0][j].x = n;
		fPoint[0][j].y = 1.6;
		fPoint[0][j].z = 0.f;
	}
	for (j = 131, n = 6.55; j <= 140; j++, n += 0.05)
	{
		fPoint[0][j].x = n;
		fPoint[0][j].y = (float)(-0.2 * n + 2.9);
		fPoint[0][j].z = 0.f;
	}
	for (j = 141, n = 7.05; j <= 180; j++, n += 0.05)
	{
		fPoint[0][j].x = n;
		fPoint[0][j].y = (float)(0.2 * n + 0.1);
		fPoint[0][j].z = 0.f;
	}
	for (j = 181, n = 9.05; j <= 200; j++, n += 0.05)
	{
		fPoint[0][j].x = n;
		fPoint[0][j].y = (float)(-0.1 * n + 2.8);
		fPoint[0][j].z = 0.f;
	}
	for (j = 201, n = 10.05; j <= 240; j++, n += 0.05)
	{
		fPoint[0][j].x = n;
		fPoint[0][j].y = (float)(0.3 * n - 1.2);
		fPoint[0][j].z = 0.f;
	}
	for (j = 241, n = 12.05; j <= 280; j++, n += 0.05)
	{
		fPoint[0][j].x = n;
		fPoint[0][j].y = (float)(0.4 * n - 2.4);
		fPoint[0][j].z = 0.f;
	}
	for (j = 281, n = 14.05; j <= 360; j++, n += 0.05)
	{
		fPoint[0][j].x = n;
		fPoint[0][j].y = (float)(0.5 * n - 3.8);
		fPoint[0][j].z = 0.f;
	}
	for (j = 361, n = 18.065; j <= 440; j++, n += 0.065)
	{
		fPoint[0][j].x = n;
		fPoint[0][j].y = (float)sqrt((float)(5.2*5.2) - (float)((n-18)*(n-18)));
		fPoint[0][j].z = 0.f;
		fPoint[0][440].y = 0.f;
	}


	//the second step
	for (j = 0, n = 0.f; j <= 60; j++, n += 0.05)
	{
		fPoint[1][j].x = n;
		fPoint[1][j].y = (float)(n * 0.7);
		fPoint[1][j].z = 0.f;
	}
	for (j = 61, n = 3.05; j <= 100; j++, n += 0.05)
	{
		fPoint[1][j].x = n;
		fPoint[1][j].y = (float)(0.1 * n + 1.8);
		fPoint[1][j].z = 0.f;
	}
	for (j = 101, n = 5.05; j <= 120; j++, n += 0.05)
	{
		fPoint[1][j].x = n;
		fPoint[1][j].y = (float)(n * 0.4 + 0.3);
		fPoint[1][j].z = 0.f;
	}
	for (j = 121, n = 6.05; j <= 130; j++, n += 0.05)
	{
		fPoint[1][j].x = n;
		fPoint[1][j].y = 2.7;
		fPoint[1][j].z = 0.f;
	}
	for (j = 131, n = 6.55; j <= 140; j++, n += 0.05)
	{
		fPoint[1][j].x = n;
		fPoint[1][j].y = (float)(-0.3 * n + 4.65);
		fPoint[1][j].z = 0.f;
	}
	for (j = 141, n = 7.05; j <= 180; j++, n += 0.05)
	{
		fPoint[1][j].x = n;
		fPoint[1][j].y = (float)(0.3 * n + 0.45);
		fPoint[1][j].z = 0.f;
	}
	for (j = 181, n = 9.05; j <= 200; j++, n += 0.05)
	{
		fPoint[1][j].x = n;
		fPoint[1][j].y = (float)(-0.1 * n + 4.05);
		fPoint[1][j].z = 0.f;
	}
	for (j = 201, n = 10.05; j <= 240; j++ , n += 0.05)
	{
		fPoint[1][j].x = n;
		fPoint[1][j].y = (float)(0.3 * n + 0.05);
		fPoint[1][j].z = 0.f;
	}
	for (j = 241, n = 12.05; j <= 280; j++, n += 0.05)
	{
		fPoint[1][j].x = n;
		fPoint[1][j].y = (float)(0.4 * n - 1.15);
		fPoint[1][j].z = 0.f;
	}
	for (j = 281, n = 14.05; j <= 320; j++, n += 0.05)
	{
		fPoint[1][j].x = n;
		fPoint[1][j].y = (float)(0.5 * n - 2.55);
		fPoint[1][j].z = 0.f;
	}
	for (j = 321, n = 16.05; j <= 360; j++, n += 0.05)
	{
		fPoint[1][j].x = n;
		fPoint[1][j].y = (float)(0.6 * n - 4.15);
		fPoint[1][j].z = 0.f;
	}
	for (j = 361, n = 18.083125; j <= 440; j++, n += 0.083125)
	{
		fPoint[1][j].x = n;
		fPoint[1][j].y = (float)sqrt((float)(6.65*6.65) - (float)((n-18)*(n-18)));
		fPoint[1][j].z = 0.f;
	}


	//the three step
	for (j = 0, n = 0.f; j <= 60; j++, n += 0.05)
	{
		fPoint[2][j].x = n;
		fPoint[2][j].y = (float)(0.9 * n);
		fPoint[2][j].z = 0.f;
	}
	for (j = 61, n = 3.05; j <= 100; j++, n += 0.05)
	{
		fPoint[2][j].x = n;
		fPoint[2][j].y = (float)(0.1 * n + 2.4);
		fPoint[2][j].z = 0.f;
	}
	for (j = 101, n = 5.05; j <= 120; j++, n += 0.05)
	{
		fPoint[2][j].x = n;
		fPoint[2][j].y = (float)(0.5 * n + 0.4);
		fPoint[2][j].z =  0.f;
	}
	for (j = 121, n = 6.05; j <= 130; j++, n += 0.05)
	{
		fPoint[2][j].x = n;
		fPoint[2][j].y = 3.4;
		fPoint[2][j].z = 0.f;
	}
	for (j = 131, n = 6.55; j <= 140; j++, n += 0.05)
	{
		fPoint[2][j].x = n;
		fPoint[2][j].y = (float)(-0.3 * n + 5.35);
		fPoint[2][j].z = 0.f;
	}
	for (j = 141, n = 7.05; j <= 180; j++, n += 0.05)
	{
		fPoint[2][j].x = n;
		fPoint[2][j].y = (float)(0.4 * n + 0.45);
		fPoint[2][j].z = 0.f;
	}
	for (j = 181, n = 9.05; j <= 200; j++, n += 0.05)
	{
		fPoint[2][j].x = n;
		fPoint[2][j].y = (float)(-0.2 * n + 5.85);
		fPoint[2][j].z = 0.f;
	}
	for (j = 201, n = 10.05; j <= 240; j++, n += 0.05)
	{
		fPoint[2][j].x = n;
		fPoint[2][j].y = (float)(0.4 * n - 0.15);
		fPoint[2][j].z = 0.f;
	}
	for ( j = 241, n = 12.05; j <= 280; j++, n += 0.05)
	{
		fPoint[2][j].x = n;
		fPoint[2][j].y = (float)(0.5 * n - 1.35);
		fPoint[2][j].z = 0.f;
	}
	for (j = 281, n = 14.05; j <= 320; j++, n += 0.05)
	{
		fPoint[2][j].x = n;
		fPoint[2][j].y = (float)(0.6 * n - 2.75);
		fPoint[2][j].z = 0.f;
	}
	for (j = 321, n = 16.05; j <= 360; j++, n += 0.05)
	{
		fPoint[2][j].x = n;
		fPoint[2][j].y = (float)(0.7 * n - 4.35);
		fPoint[2][j].z = 0.f;
	}
	for (j = 361, n = 18.103125; j <= 440; j++, n += 0.103125)
	{
		fPoint[2][j].x = n;
		fPoint[2][j].y = (float)sqrt((float)(8.25*8.25) - (float)((n-18)*(n-18)));
		fPoint[2][j].z = 0.f;
	}

	//Get the Axis points
	for (i = 0, n = 0.f; i <= 360; i++, n += 0.05)
	{
		fPoint[3][i].x = n;
		fPoint[3][i].y = 0.f;
		fPoint[3][i].z = 0.f;
	}
	for (i = 361, n = 18.065; i <= 440; i++, n += 0.065)
	{
		fPoint[3][i].x = n;
		fPoint[3][i].y = 0.f;
		fPoint[3][i].z = 0.f;
	}

	//Get the symmetrical points
	for (i = 0; i < 3; i++)
	{
		for (j = 0; j <= 440; j++)
		{
			fPoint[i+4][j].x = fPoint[i][j].x;
			fPoint[i+4][j].y = -fPoint[i][j].y;
			fPoint[i+4][j].z = 0.f;
		}
	}

	return fPoint;
}

Point3f **CBigMassDiffuseModulesInterface::GetBigMassDiffuseModuleSix(float sa, float sb)
{
	Point3f **fPoint;
	unsigned int i, j;
	float n;

	//Initial the pointer
	fPoint = new Point3f *[7];
	for (i = 0; i < 7; i++)
	{
		fPoint[i] = new Point3f[721];
	}

	assert(fPoint);

	//the first step
	for (j = 0, n = 0.f; j <= 80; j++, n += 0.05)
	{
		fPoint[0][j].x = n;
		fPoint[0][j].y = (float)(0.4 * n);
		fPoint[0][j].z = 0.f;
	}
	for (j = 81, n = 4.05; j <= 140; j++, n += 0.05)
	{
		fPoint[0][j].x = n;
		fPoint[0][j].y = (float)(0.1 * n + 1.2);
		fPoint[0][j].z = 0.f;
	}
	for (j = 141, n = 7.05; j <= 200; j++, n += 0.05)
	{
		fPoint[0][j].x = n;
		fPoint[0][j].y = (float)(0.2 * n + 0.5);
		fPoint[0][j].z = 0.f;
	}
	for (j = 201, n = 10.05; j <= 220; j++, n += 0.05)
	{
		fPoint[0][j].x = n;
		fPoint[0][j].y = (float)(-0.1 * n + 3.5);
		fPoint[0][j].z = 0.f;
	}
	for (j = 221, n = 11.05; j <= 280; j++, n += 0.05)
	{
		fPoint[0][j].x = n;
		fPoint[0][j].y = (float)(0.3 * n - 0.9);
		fPoint[0][j].z = 0.f;
	}
	for (j = 281, n = 14.05; j <= 300; j++, n += 0.05)
	{
		fPoint[0][j].x = n;
		fPoint[0][j].y = (float)(-0.1 * n + 4.7);
		fPoint[0][j].z = 0.f;
	}
	for (j = 301, n = 15.05; j <= 340; j++, n += 0.05)
	{
		fPoint[0][j].x = n;
		fPoint[0][j].y = (float)(0.2 * n + 0.2);
		fPoint[0][j].z = 0.f;
	}
	for (j = 341, n = 17.05; j <= 400; j++, n += 0.05)
	{
		fPoint[0][j].x = n;
		fPoint[0][j].y = (float)(0.3 * n  - 1.5);
		fPoint[0][j].z =  0.f;
	}
	for (j = 401, n = 20.5; j <= 460; j++, n += 0.05)
	{
		fPoint[0][j].x = n;
		fPoint[0][j].y = (float)(0.4 * n - 3.5);
		fPoint[0][j].z = 0.f;
	}
	for (j = 461, n = 23.05; j <= 480; j++, n += 0.05)
	{
		fPoint[0][j].x = n;
		fPoint[0][j].y = (float)(-0.2 * n + 10.3);
		fPoint[0][j].z = n;
	}
	for (j = 481, n = 24.05; j <= 520; j++, n += 0.05)
	{
		fPoint[0][j].x = n;
		fPoint[0][j].y = (float)(0.3 * n - 1.7);
		fPoint[0][j].z = 0.f;
	}
	for (j = 521, n = 26.05; j <= 580; j++, n += 0.05)
	{
		fPoint[0][j].x = n;
		fPoint[0][j].y = (float)(0.4 * n - 4.3);
		fPoint[0][j].z = 0.f;
	}
	for (j = 581, n = 29.05; j <= 620; j++, n += 0.05)
	{
		fPoint[0][j].x = n;
		fPoint[0][j].y = (float)(0.5 * n - 7.2);
		fPoint[0][j].z = 0.f;
	}
	for (j = 621, n = 31.083; j <= 720; j++, n += 0.083)
	{
		fPoint[0][j].x = n;
		fPoint[0][j].y = (float)sqrt((float)(8.3*8.3) - (float)((n-31)*(n-31)));
		fPoint[0][j].z = 0.f;
		fPoint[0][720].y = 0.f;
	}


	//the second step
	for (j = 0, n = 0.f; j <= 80; j++, n += 0.05)
	{
		fPoint[1][j].x = n;
		fPoint[1][j].y = (float)(0.6 * n);
		fPoint[1][j].z = 0.f;
	}
	for (j = 81, n = 4.05; j <= 140; j++, n += 0.05)
	{
		fPoint[1][j].x = n;
		fPoint[1][j].y = (float)(0.1 * n + 2);
		fPoint[1][j].z = 0.f;
	}
	for (j = 141, n = 7.05; j <= 200; j++, n += 0.05)
	{
		fPoint[1][j].x = n;
		fPoint[1][j].y = (float)(0.3 * n  + 0.6);
		fPoint[1][j].z = 0.f;
	}
	for (j = 201, n = 10.05; j <= 220; j++, n += 0.05)
	{
		fPoint[1][j].x = n;
		fPoint[1][j].y = (float)(-0.1 * n + 4.6);
		fPoint[1][j].z = 0.f;
	}
	for (j = 221, n = 11.05; j <= 280; j++, n += 0.05)
	{
		fPoint[1][j].x = n;
		fPoint[1][j].y = (float)(0.4 * n - 0.9);
		fPoint[1][j].z = 0.f;
	}
	for (j = 281, n = 14.05; j <= 300; j++, n += 0.05)
	{
		fPoint[1][j].x = n;
		fPoint[1][j].y = (float)(-0.1 * n + 6.1);
		fPoint[1][j].z = 0.f;
	}
	for (j = 301, n = 15.05; j <= 340; j++, n += 0.05)
	{
		fPoint[1][j].x = n;
		fPoint[1][j].y = (float)(0.3 * n + 0.1);
		fPoint[1][j].z = 0.f;
	}
	for (j = 341, n = 17.05; j <= 400; j++, n += 0.05)
	{
		fPoint[1][j].x = n;
		fPoint[1][j].y = (float)(0.4 * n - 1.6);
		fPoint[1][j].z = 0.f;
	}
	for (j = 401, n = 20.05; j <= 460; j++, n += 0.05)
	{
		fPoint[1][j].x = n;
		fPoint[1][j].y = (float)(0.5 * n - 3.6);
		fPoint[1][j].z = 0.f;
	}
	for (j = 461, n = 23.05; j <= 480; j++, n += 0.05)
	{
		fPoint[1][j].x = n;
		fPoint[1][j].y = (float)(-0.2 * n + 12.5);
		fPoint[1][j].z = 0.f;
	}
	for (j = 481, n = 24.05; j <= 520; j++, n += 0.05)
	{
		fPoint[1][j].x = n;
		fPoint[1][j].y = (float)(0.4 * n - 1.9);
		fPoint[1][j].z = 0.f;
	}
	for (j = 521, n = 26.05; j <= 580; j++, n += 0.05)
	{
		fPoint[1][j].x = n;
		fPoint[1][j].y = (float)(0.5 * n - 4.5);
		fPoint[1][j].z = 0.f;
	}
	for (j = 581, n = 29.05; j <= 620; j++, n += 0.05)
	{
		fPoint[1][j].x = n;
		fPoint[1][j].y = (float)(0.6 * n - 7.4);
		fPoint[1][j].z = 0.f;
	}
	for (j = 621, n = 31.112; j <= 720; j++, n += 0.112)
	{
		fPoint[1][j].x = n;
		fPoint[1][j].y = (float)sqrt((float)(11.2*11.2) - (float)((n-31)*(n-31)));
		fPoint[1][j].z = 0.f;
	}


	//the third step
	for (j = 0, n = 0.f; j <= 80; j++, n += 0.05)
	{
		fPoint[2][j].x = n;
		fPoint[2][j].y = (float)(n * 0.8);
		fPoint[2][j].z = 0.f;
	}
	for (j = 81, n = 4.05; j <= 140; j++, n += 0.05)
	{
		fPoint[2][j].x = n;
		fPoint[2][j].y = (float)(0.1 * n + 2.8);
		fPoint[2][j].z = 0.f;
	}
	for (j = 141, n = 7.05; j <= 200; j++, n += 0.05)
	{
		fPoint[2][j].x = n;
		fPoint[2][j].y = (float)(0.3 * n + 1.4);
		fPoint[2][j].z = 0.f;
	}
	for (j = 201, n = 10.05; j <= 220; j++, n += 0.05)
	{
		fPoint[2][j].x = n;
		fPoint[2][j].y = (float)(-0.1 * n + 5.4);
		fPoint[2][j].z = 0.f;
	}
	for (j = 221, n = 11.05; j <= 280; j++, n += 0.05)
	{
		fPoint[2][j].x = n;
		fPoint[2][j].y = (float)(0.5 * n - 1.2);
		fPoint[2][j].z = 0.f;
	}
	for (j = 281, n = 14.05; j <= 300; j++, n += 0.05)
	{
		fPoint[2][j].x = n;
		fPoint[2][j].y = (float)(-0.1 * n + 7.2);
		fPoint[2][j].z = 0.f;
	}
	for (j = 301, n = 15.05; j <= 340; j++, n += 0.05)
	{
		fPoint[2][j].x = n;
		fPoint[2][j].y = (float)(0.4 * n - 0.3);
		fPoint[2][j].z = 0.f;
	}
	for (j = 341, n = 17.05; j <= 400; j++, n += 0.05)
	{
		fPoint[2][j].x = n;
		fPoint[2][j].y = (float)(0.5 * n - 2.0);
		fPoint[2][j].z = 0.f;
	}
	for (j = 401, n = 20.05; j <= 460; j++, n += 0.05)
	{
		fPoint[2][j].x = n;
		fPoint[2][j].y = (float)(0.6 * n - 4.0);
		fPoint[2][j].z = 0.f;
	}
	for (j = 461, n = 23.05; j <= 480; j++, n += 0.05)
	{
		fPoint[2][j].x = n;
		fPoint[2][j].y = (float)(-0.2 * n + 14.4);
		fPoint[2][j].z = 0.f;
	}
	for (j = 481, n = 24.05; j <= 520; j++, n += 0.05)
	{
		fPoint[2][j].x = n;
		fPoint[2][j].y = (float)(0.5 * n - 2.4);
		fPoint[2][j].z = 0.f;
	}
	for (j = 521, n = 26.05; j <= 580; j++, n += 0.05)
	{
		fPoint[2][j].x = n;
		fPoint[2][j].y = (float)(0.6 * n - 5.6);
		fPoint[2][j].z = 0.f;
	}
	for (j = 581, n = 29.05; j <= 620; j++, n += 0.05)
	{
		fPoint[2][j].x = n;
		fPoint[2][j].y = (float)(0.7 * n - 8.5);
		fPoint[2][j].z = 0.f;
	}
	for (j = 621, n = 31.132; j <= 720; j++, n += 0.132)
	{
		fPoint[2][j].x = n;
		fPoint[2][j].y = (float)sqrt((float)(13.2*13.2) - (float)((n-31.0)*(n-31.0)));
		fPoint[2][j].z = 0.f;
	}

	//Get the axis points
	for (j = 0, n = 0.f; j <= 620; j++, n += 0.05)
	{
		fPoint[3][j].x = n;
		fPoint[3][j].y = 0.f;
		fPoint[3][j].z = 0.f;
	}
	for (j = 621, n = 31.083; j <= 720; j++, n += 0.083)
	{
		fPoint[3][j].x = n;
		fPoint[3][j].y = 0.f;
		fPoint[3][j].z = 0.f;
	}

	//Get the symmetrical points
	for (i = 0; i < 3; i++)
	{
		for (j = 0; j <= 720; j++)
		{
			fPoint[i+4][j].x = fPoint[i][j].x;
			fPoint[i+4][j].y = -fPoint[i][j].y;
			fPoint[i+4][j].z = 0.f;
		}
	}
	return fPoint;
}


/********************************************
The middle function
********************************************/
void CBigMassDiffuseModulesInterface::MassMiddleFunction(Point3f ** fPoint, int n)
{
	int j;
	for (j = 0; j <= n; j++)
	{
		
		glBegin(GL_QUADS);
		glColor3f(1.0, 0.0f, 0.0f);
		glVertex3f(fPoint[0][j].x, fPoint[0][j].y, fPoint[0][j].z);
		glVertex3f(fPoint[0][j+1].x, fPoint[0][j+1].y, fPoint[0][j+1].z);
		glVertex3f(fPoint[1][j+1].x, fPoint[1][j+1].y, fPoint[1][j+1].z);
		glVertex3f(fPoint[1][j].x, fPoint[1][j].y, fPoint[1][j].z);

		glVertex3f(fPoint[5][j].x, fPoint[5][j].y, fPoint[5][j].z);
		glVertex3f(fPoint[5][j+1].x, fPoint[5][j+1].y, fPoint[5][j+1].z);
		glVertex3f(fPoint[4][j+1].x, fPoint[4][j+1].y, fPoint[4][j+1].z);
		glVertex3f(fPoint[4][j].x, fPoint[4][j].y, fPoint[4][j].z);

		glColor3f(1.0, 1.0, 0.0);
		glVertex3f(fPoint[1][j].x, fPoint[1][j].y, fPoint[1][j].z);
		glVertex3f(fPoint[1][j+1].x, fPoint[1][j+1].y, fPoint[1][j+1].z);
		glVertex3f(fPoint[2][j+1].x, fPoint[2][j+1].y, fPoint[2][j+1].z);
		glVertex3f(fPoint[2][j].x, fPoint[2][j].y, fPoint[2][j].z);

		glVertex3f(fPoint[5][j].x, fPoint[5][j].y, fPoint[5][j].z);
		glVertex3f(fPoint[5][j+1].x, fPoint[5][j+1].y, fPoint[5][j+1].z);
		glVertex3f(fPoint[6][j+1].x, fPoint[6][j+1].y, fPoint[6][j+1].z);
		glVertex3f(fPoint[6][j].x, fPoint[6][j].y, fPoint[6][j].z);
		glEnd();
	}
	for (j = 0; j <= n; j++)
	{
		glBegin(GL_QUADS);
		glColor3f(0.f, 0.f, 1.f);
		glVertex3f(fPoint[0][j].x, fPoint[0][j].y, fPoint[0][j].z);
		glVertex3f(fPoint[0][j+1].x, fPoint[0][j+1].y, fPoint[0][j+1].z);
		glVertex3f(fPoint[3][j+1].x, fPoint[3][j+1].y, fPoint[3][j+1].z);
		glVertex3f(fPoint[3][j].x, fPoint[3][j].y, fPoint[3][j].z);

		glVertex3f(fPoint[4][j].x, fPoint[4][j].y, fPoint[4][j].z);
		glVertex3f(fPoint[4][j+1].x, fPoint[4][j+1].y, fPoint[4][j+1].z);
		glVertex3f(fPoint[3][j+1].x, fPoint[3][j+1].y, fPoint[3][j+1].z);
		glVertex3f(fPoint[3][j].x, fPoint[3][j].y, fPoint[3][j].z);
		glEnd();
	}
}


/****************************************************
The Small Mass Modules
****************************************************/

CSmallMassDiffuseModulesInterface::CSmallMassDiffuseModulesInterface()
	:m_MassDiffuseModules(NULL)
{
}

CSmallMassDiffuseModulesInterface::~CSmallMassDiffuseModulesInterface()
{
	if (m_MassDiffuseModules)
	{
		m_MassDiffuseModules = NULL;
		delete m_MassDiffuseModules;
	}
	
}

Point3f **CSmallMassDiffuseModulesInterface::GetSmallMassDiffuseModuleOne(float oa, float ob)
{
	Point3f **fPoint;
	unsigned int i, j;
	float n;

	//Initial the points
	fPoint = new Point3f *[7];
	for (i = 0; i < 7; i++)
	{
		fPoint[i] = new Point3f[11];
	}

	assert(fPoint);

	//the first step
	for ( j = 0, n = 0.f; j <= 10; j++, n += (float)(0.2 * (float)sqrt(0.075)))
	{
		fPoint[2][j].x = n;
		fPoint[2][j].y = -2.0 * ((float)((n - (float)sqrt(0.075))*(n - (float)sqrt(0.075)))) + 0.15;
		fPoint[2][j].z = 0.f;
	}

	//the second step
	for (j = 0, n = 0.f; j <= 10; j++, n += 0.2 * (float)sqrt(0.025))
	{
		fPoint[1][j].x = n;
		fPoint[1][j].y = -4.0 * ((float)((n - (float)sqrt(0.025))*(n - (float)sqrt(0.025)))) + 0.1;
		fPoint[1][j].z = 0.f;
	}

	//the third step
	for (j = 0, n = 0.f; j <= 10; j++, n += 0.02)
	{
		fPoint[0][j].x = n;
		fPoint[0][j].y = -5.0 * ((float)((n-0.1)*(n-0.1))) + 0.05;
		fPoint[0][j].z = 0.f;
	}

	//get the Axis points
	for (j = 0, n = 0.f; j <= 10; j++, n += 0.02)
	{
		fPoint[3][j].x = n;
		fPoint[3][j].y = 0.f;
		fPoint[3][j].z = 0.f;
	}

	//get the symmetrical points
	for (i = 0; i < 3; i++)
	{
		for (j = 0; j <= 10; j++)
		{
			fPoint[i+4][j].x = fPoint[i][j].x;
			fPoint[i+4][j].y = -fPoint[i][j].y;
			fPoint[i+4][j].z = 0.f;
		}
	}

	return fPoint;
}

Point3f **CSmallMassDiffuseModulesInterface::GetSmallMassDiffuseModuleTwo(float ta, float tb)
{
	Point3f **fPoint;
	unsigned int i, j;
	float n;

	fPoint = new Point3f *[7];
	for (i = 0; i < 7; i++)
	{
		fPoint[i] = new Point3f[21];
	}

	assert(fPoint);

	//the first step
	for (j = 0, n = 0.f; j <= 20; j++, n += (float)(0.1 * (float)sqrt(0.1)))
	{
		fPoint[0][j].x = n;
		fPoint[0][j].y = -2.0 * ((float)((n-(float)sqrt(0.1)) * (n-(float)sqrt(0.1)))) + 0.2;
		fPoint[0][j].z = 0.f;
	}

	//the second step
	for (j = 0, n = 0.f; j <= 20; j++, n += (float)(0.1 * (float)sqrt(0.4)))
	{
		fPoint[1][j].x = n;
		fPoint[1][j].y = -1.0 * ((float)((n-(float)sqrt(0.4)) * (n-(float)sqrt(0.4)))) + 0.4;
		fPoint[1][j].z = 0.f;
	}

	//the third step
	for (j = 0, n = 0.f; j <= 20; j++, n += (float)(0.1 * (float)sqrt(1.6)))
	{
		fPoint[2][j].x = n;
		fPoint[2][j].y = -0.5 * ((float)((n-(float)sqrt(1.6)) * (n-(float)sqrt(1.6)))) + 0.8;
		fPoint[2][j].z = 0.f;
	}

	//Get the Axis points
	for (j = 0, n = 0.f; j <= 20; j++, n += (float)(0.1 * (float)sqrt(0.1)))
	{
		fPoint[3][j].x = n;
		fPoint[3][j].y = 0.f;
		fPoint[3][j].z = 0.f;
	}

	//Get the symmetrical points
	for (i = 0; i < 3; i++)
	{
		for (j = 0; j <= 20; j++)
		{
			fPoint[i+4][j].x = fPoint[i][j].x;
			fPoint[i+4][j].y = -fPoint[i][j].y;
			fPoint[i+4][j].z = 0.f;
		}
	}

	return fPoint;
}

Point3f **CSmallMassDiffuseModulesInterface::GetSmallMassDiffuseModuleThree(float ra, float rb)
{
	Point3f **fPoint;
	unsigned int i, j;
	float n;

	//Initial the point
	fPoint = new Point3f *[7];
	for (i = 0; i < 7; i++)
	{
		fPoint[i] = new Point3f[41];
	}

	assert(fPoint);

	//the first step
	for (j = 0, n = 0.f; j <= 40; j++, n += (float)(0.05 * (float)sqrt(0.6)))
	{
		fPoint[0][j].x = n;
		fPoint[0][j].y = -1.0 * ((float)((n-(float)sqrt(0.6)) * (n-(float)sqrt(0.6)))) + 0.6;
		fPoint[0][j].z = 0.f;
	}

	//the second step
	for (j = 0, n = 0.f; j <= 40; j++, n += (float)(0.05 * (float)sqrt(2.0)))
	{
		fPoint[1][j].x = n;
		fPoint[1][j].y = -0.6 * ((float)((n-(float)sqrt(2.0)) * (n-(float)sqrt(2.0)))) + 1.2;
		fPoint[1][j].z = 0.f;
	}

	//the third step
	for (j = 0, n = 0.f; j <= 40; j++, n += (float)((0.05) * (float)sqrt(5.0)))
	{
		fPoint[2][j].x = n;
		fPoint[2][j].y = -0.4 * ((float)((n-(float)sqrt(5.0)) * (n-(float)sqrt(5.0)))) + 2.0;
		fPoint[2][j].z = 0.f;
	}

	//Get the Axis points
	for (j = 0, n = 0.f; j <= 40; j++, n += (float)(0.05 * (float)sqrt(0.6)))
	{
		fPoint[3][j].x = n;
		fPoint[3][j].y = 0.f;
		fPoint[3][j].z = 0.f;
	}

	//Get the symmetrical points
	for (i = 0; i < 3; i++)
	{
		for (j = 0; j <= 40; j++)
		{
			fPoint[i+4][j].x = fPoint[i][j].x;
			fPoint[i+4][j].y = -fPoint[i][j].y;
			fPoint[i+4][j].z = 0.f;
		}
	}

	return fPoint;
}

Point3f **CSmallMassDiffuseModulesInterface::GetSmallMassDiffuseModuleFour(float fa, float fb)
{
	Point3f **fPoint;
	unsigned int i, j;
	float n;

	//Initial the point
	fPoint = new Point3f *[7];
	for (i = 0; i < 7; i++)
	{
		fPoint[i] = new Point3f[51];
	}

	assert(fPoint);

	//the first step
	for (j = 0, n = 0.f; j <= 50; j++, n += (float)(0.04 * (float)sqrt(1.25)))
	{
		fPoint[0][j].x = n;
		fPoint[0][j].y = -0.8 * ((float)((n-(float)sqrt(1.25)) * (n-(float)sqrt(1.25)))) + 1.0;
		fPoint[0][j].z = 0.f;
	}

	//the second step
	for (j = 0, n = 0.f; j <= 50; j++, n += (float)(0.04 * (float)sqrt(5.0)))
	{
		fPoint[1][j].x = n;
		fPoint[1][j].y = -0.4 * ((float)((n-(float)sqrt(5.0)) * (n-(float)sqrt(5.0)))) + 2.0;
		fPoint[1][j].z = 0.f;
	}

	//the third step
	for (j = 0, n = 0.f; j <= 50; j++, n += (float)(0.04 * (float)sqrt(15.0)))
	{
		fPoint[2][j].x = n;
		fPoint[2][j].y = -0.2 * ((float)((n-(float)sqrt(15.0)) * (n-(float)sqrt(15.0)))) + 3.0;
		fPoint[2][j].z = 0.f;
	}

	//Get the Axis point
	for (j = 0, n = 0.f; j <= 50; j++, n += (float)(0.04 * (float)sqrt(1.25)))
	{
		fPoint[3][j].x = n;
		fPoint[3][j].y = 0.f;
		fPoint[3][j].z = 0.f;
	}

	//Get the symmetrical points
	for (i = 0; i < 3; i++)
	{
		for (j = 0; j <= 50; j++)
		{
			fPoint[i+4][j].x = fPoint[i][j].x;
			fPoint[i+4][j].y = -fPoint[i][j].y;
			fPoint[i+4][j].z = 0.f;
		}
	}

	return fPoint;
}

Point3f **CSmallMassDiffuseModulesInterface::GetSmallMassDiffuseModuleFive(float va, float vb)
{
	Point3f **fPoint;
	unsigned int i, j;
	float n;

	//Initial the point
	fPoint = new Point3f *[7];
	for (i = 0; i < 7; i++)
	{
		fPoint[i] = new Point3f[81];
	}

	assert(fPoint);

	//the first step
	for (j = 0, n = 0.f; j <= 80; j++, n += 0.05)
	{
		fPoint[2][j].x = n;
		fPoint[2][j].y = -1.0 * ((float)((n-2.0) * (n-2.0))) + 4.0;
		fPoint[2][j].z = 0.f;
	}

	//the second step
	for (j = 0, n = 0.f; j <= 80; j++, n += 0.025)
	{
		fPoint[1][j].x = n;
		fPoint[1][j].y = -2.0 * ((float)((n-1.0) * (n-1.0))) + 2.0;
		fPoint[1][j].z = 0.f;
	}

	//the third step
	for (j = 0, n = 0.f; j <= 80; j++, n += (float)(0.025 * (float)sqrt(0.4)))
	{
		fPoint[0][j].x = n;
		fPoint[0][j].y = -3.0 * ((float)((n-(float)sqrt(0.4)) * (n-(float)sqrt(0.4)))) + 1.2;
		fPoint[0][j].z = 0.f;
	}

	//Get the Axis points
	for (j = 0, n = 0.f; j <= 80; j++, n += (float)(0.025 * (float)sqrt(0.4)))
	{
		fPoint[3][j].x = n;
		fPoint[3][j].y = 0.f;
		fPoint[3][j].z = 0.f;
	}

	//Get the  symmetrical points
	for (i = 0; i < 3; i++)
	{
		for (j = 0; j <= 80; j++)
		{
			fPoint[i+4][j].x = fPoint[i][j].x;
			fPoint[i+4][j].y = -fPoint[i][j].y;
			fPoint[i+4][j].z = 0.f;
		}
	}

	return fPoint;
}

Point3f **CSmallMassDiffuseModulesInterface::GetSmallMassDiffuseModuleSix(float sa, float sb)
{
	Point3f **fPoint;
	unsigned int i, j;
	float n;

	//Initial the point
	fPoint = new Point3f *[7];
	for (i = 0; i < 7; i++)
	{
		fPoint[i] = new Point3f[101];
	}

	assert(fPoint);

	//the first step
	for (j = 0, n = 0.f; j <= 100; j++, n += (float)(0.02 * (float)sqrt(5.0)))
	{
		fPoint[2][j].x = n;
		fPoint[2][j].y = -1.0 * ((float)((n-(float)sqrt(5.0)) * (n-(float)sqrt(5.0)))) + 5.0;
		fPoint[2][j].z = 0.f;
	}

	//the second step
	for (j = 0, n = 0.f; j <= 100; j++, n += 0.02)
	{
		fPoint[1][j].x = n;
		fPoint[1][j].y = -3.0 * ((float)((n-1.0)*(n-1.0))) + 3.0;
		fPoint[1][j].z = 0.f;
	}

	//the third step
	for (j = 0, n = 0.f; j <= 100; j++, n += (float)(0.02 * (float)sqrt(0.4)))
	{
		fPoint[0][j].x = n;
		fPoint[0][j].y = -5.0 *((float)((n-(float)sqrt(0.4))*(n-(float)sqrt(0.4)))) + 2.0;
		fPoint[0][j].z = 0.f;
	}

	//Get the Axis point
	for (j = 0, n = 0.f; j <= 100; j++, n += (float)(0.02 * (float)sqrt(0.4)))
	{
		fPoint[3][j].x = n;
		fPoint[3][j].y = 0.f;
		fPoint[3][j].z = 0.f;
	}

	//Get the symmetrical points
	for (i = 0; i < 3; i++)
	{
		for (j = 0; j <= 100; j++)
		{
			fPoint[i+4][j].x = fPoint[i][j].x;
			fPoint[i+4][j].y = -fPoint[i][j].y;
			fPoint[i+4][j].z = 0.f;
		}
	}

	return fPoint;
}


/*******************************************
Show the Big Mass Module.
*******************************************/
void CBigMassDiffuseModulesInterface::RenderBigMassDiffuseModuleOne()
{
	Point3f **fPointOne;

	fPointOne = GetBigMassDiffuseModuleOne(0.0, 0.0);
	MassMiddleFunction(fPointOne, 49);

	delete fPointOne;
}

void CBigMassDiffuseModulesInterface::RenderBigMassDiffuseModuleTwo()
{
	Point3f **fPointTwo;

	fPointTwo = GetBigMassDiffuseModuleTwo(0.0, 0.0);
	MassMiddleFunction(fPointTwo, 89);

	delete fPointTwo;
}

void CBigMassDiffuseModulesInterface::RenderBigMassDiffuseModuleThree()
{
	Point3f **fPointThree;

	fPointThree = GetBigMassDiffuseModuleThree(0.0, 0.0);
	MassMiddleFunction(fPointThree, 179);

	delete fPointThree;
}

void CBigMassDiffuseModulesInterface::RenderBigMassDiffuseModuleFour()
{
	Point3f **fPointFour;

	fPointFour = GetBigMassDiffuseModuleFour(0.0, 0.0);
	MassMiddleFunction(fPointFour, 279);

	delete fPointFour;
}

void CBigMassDiffuseModulesInterface::RenderBigMassDiffuseModuleFive()
{
	Point3f **fPointFive;

	fPointFive = GetBigMassDiffuseModuleFive(0.0, 0.0);
	MassMiddleFunction(fPointFive, 439);

	delete fPointFive;
}

void CBigMassDiffuseModulesInterface::RenderBigMassDiffuseModuleSix()
{
	Point3f **fPointSix;

	fPointSix = GetBigMassDiffuseModuleSix(0.0, 0.0);
	MassMiddleFunction(fPointSix, 719);

	delete fPointSix;
}


/**************************************************
Show the Small Modules
**************************************************/
void CSmallMassDiffuseModulesInterface::RenderSmallMassDiffuseModuleOne()
{
	Point3f **fPointOne;

	fPointOne = GetSmallMassDiffuseModuleOne(0.0, 0.0);
	m_MassDiffuseModules->MassMiddleFunction(fPointOne, 9);

	delete fPointOne;
}

void CSmallMassDiffuseModulesInterface::RenderSmallMassDiffuseModuleTwo()
{
	Point3f **fPointTwo;

	fPointTwo = GetSmallMassDiffuseModuleTwo(0.0, 0.0);
	m_MassDiffuseModules->MassMiddleFunction(fPointTwo, 19);

	delete fPointTwo;
}

void CSmallMassDiffuseModulesInterface::RenderSmallMassDiffuseModuleThree()
{
	Point3f **fPointThree;

	fPointThree = GetSmallMassDiffuseModuleThree(0.0, 0.0);
	m_MassDiffuseModules->MassMiddleFunction(fPointThree, 39);

	delete fPointThree;
}

void CSmallMassDiffuseModulesInterface::RenderSmallMassDiffuseModuleFour()
{
	Point3f **fPointFour;

	fPointFour = GetSmallMassDiffuseModuleFour(0.0, 0.0);
	m_MassDiffuseModules->MassMiddleFunction(fPointFour, 49);

	delete fPointFour;
}

void CSmallMassDiffuseModulesInterface::RenderSmallMassDiffuseModuleFive()
{
	Point3f **fPointFive;

	fPointFive = GetSmallMassDiffuseModuleFive(0.0, 0.0);
	m_MassDiffuseModules->MassMiddleFunction(fPointFive, 79);

	delete fPointFive;
}

void CSmallMassDiffuseModulesInterface::RenderSmallMassDiffuseModuleSix()
{
	Point3f **fPointSix;

	fPointSix = GetSmallMassDiffuseModuleSix(0.0, 0.0);
	m_MassDiffuseModules->MassMiddleFunction(fPointSix, 99);

	delete fPointSix;
}